﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using SaysayTalkDemo.Models;


namespace SaysayTalkDemo.Data
{
    public class SayDemoDbinit : DropCreateDatabaseAlways<SayDemoDb>
    {
        protected override void Seed(SayDemoDb db)
        {
            db.Users.Add(new Models.Users
            {
                Username = "admin",
                PassWord = "113",
                CreateAt = DateTime.Now,
                UpdataAt = DateTime.Now,
                Version = 0
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="你的柔情我永远不懂",
                    CreateAt=DateTime.Now,
                    UpdataAt=DateTime.Now,
                    Version=0
                }
            });

            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    MsgId=1,
                    FromUserId=1,
                    Content="芳草依依",
                    CreateAt=DateTime.Now,
                    UpdataAt=DateTime.Now,
                    Version=0
                }
            });

            db.SaveChanges();



            base.Seed(db);
        }
    }
}
